import React, { memo, useState } from 'react'

const CountHook = memo((props) => {
  // useState返回值是一个数组,第一个值是状态值，第二个值是一个函数
  const [count, setCount] = useState(0)
  return (
    <div>
      <div>函数组件</div>
      <div>当前计数：{count}</div>
      <button onClick={e => setCount(count+1)}>+1</button>
      <button onClick={e => setCount(count-1)}>-1</button>
    </div>
  )
})

export default CountHook